package com.tanhua.server.controller;

import com.tanhua.server.service.SoundService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

@RestController
@RequestMapping("/peachblossom")
public class PeachblossomController {

    @Autowired
    private SoundService soundService;

    //发送语音
    //请求方式：POST
    //请求路径：/peachblossom
    //请求参数：soundFile	文件	是
    //返回值：无
    @PostMapping(name = "发送语音")
    public ResponseEntity sendSound(MultipartFile soundFile) throws IOException {
        return soundService.sendSound(soundFile);
    }


    //接收语音
    //请求方式：GET
    //请求路径：/peachblossom
    //请求参数：soundFile	文件	是
    //返回值：无
    @GetMapping(name = "接收语音")
    public ResponseEntity getSound() {
        return soundService.getSound();
    }
}
